﻿using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.DirectX.Direct3D;
using KGE.Define;

namespace KGE.Resource
{
    public class KMovies
    {
        List<KMovie> items = new List<KMovie>();
        public int GetIndex(string name)
        {
            int i = 0;
            foreach (KMovie item in items)
            {
                if (name.ToLower() == item.Name.ToLower())
                {
                    return i;
                }
                i++;
            }
            return -1;
        }
        public void Add(KMovie km)
        {
            items.Add(km);
        }
        public void Del(string name)
        {
            int i = GetIndex(name);
            items.RemoveAt(i);
        }
        public void Del(int index)
        {
            items.RemoveAt(index);
        }
        public int Count
        {
            get
            {
                return items.Count;
            }
        }
        public KMovie this[int index]
        {
            get
            {
                if (index < 0)
                {
                    return null;
                }
                return items[index];
            }
        }
        public KMovie this[string name]
        {
            get
            {
                int i = GetIndex(name);
                return items[i];
            }
        }
    }
}
